<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Lib_daemon {

	function modem_status()
	{
		$CI =& get_instance();

		$toleransi = $CI->config->item('toleransi');
		$query = $CI->db->query("SELECT ABS(TIMEDIFF(TimeOut,NOW())) < $toleransi as status FROM `phones` WHERE 1");
		$hasil = $query->result();

		if ($hasil[0]->status == 1)
			return 'tersambung';
		else
			return 'terputus';

	}
}